if ((c = tb[IFACE_ATTR_RA_REACHABLETIME])) {
uint32_t ra_reachabletime = blobmsg_get_u32(c);
- /* RFC4861 §6.2.1 : AdvReachableTime :
+ /* RFC4861 §6.2.1 : AdvReachableTime :
* MUST be no greater than 3,600,000 msec
*/
iface->ra_reachabletime = ra_reachabletime <= AdvReachableTime ? ra_reachabletime : AdvReachableTime;
uint32_t ra_maxinterval = blobmsg_get_u32(c);
if (ra_maxinterval < 4)
ra_maxinterval = 4;
- else if (ra_maxinterval > MaxRtrAdvInterval)
+ else if (ra_maxinterval > MaxRtrAdvInterval)
ra_maxinterval = MaxRtrAdvInterval;
iface->ra_maxinterval = ra_maxinterval;
}
uint32_t ra_mininterval = blobmsg_get_u32(c);
if (ra_mininterval < MinRtrAdvInterval)
ra_mininterval = MinRtrAdvInterval; // clamp min
- else if (ra_mininterval > (0.75 * iface->ra_maxinterval))
+ else if (ra_mininterval > (0.75 * iface->ra_maxinterval))
ra_mininterval = 0.75 * iface->ra_maxinterval; // clamp max
iface->ra_mininterval = ra_mininterval;
}
- /*
+ /*
* RFC4861: AdvDefaultLifetime: MUST be either zero or between MaxRtrAdvInterval and 9000 seconds.
* RFC8319: AdvDefaultLifetime: MUST be either zero or between MaxRtrAdvInterval and 65535 seconds.
* Default: 3 * MaxRtrAdvInterval
if ((c = tb[IFACE_ATTR_RA_LIFETIME])){
uint32_t ra_lifetime = blobmsg_get_u32(c);
if (ra_lifetime != 0){
- if (ra_lifetime < iface->ra_maxinterval)
+ if (ra_lifetime < iface->ra_maxinterval)
ra_lifetime = iface->ra_maxinterval; // clamp min
else if (ra_lifetime > AdvDefaultLifetime)
ra_lifetime = AdvDefaultLifetime; // clamp max
iov[IOV_DHCPV6_RAW].iov_len +
iov[IOV_NTP].iov_len + iov[IOV_NTP_ADDR].iov_len +
iov[IOV_SNTP].iov_len + iov[IOV_SNTP_ADDR].iov_len +
- iov[IOV_POSIX_TZ].iov_len + iov[IOV_POSIX_TZ_STR].iov_len +
+ iov[IOV_POSIX_TZ].iov_len + iov[IOV_POSIX_TZ_STR].iov_len +
iov[IOV_TZDB_TZ].iov_len + iov[IOV_TZDB_TZ_STR].iov_len +
iov[IOV_DNR].iov_len + iov[IOV_BOOTFILE_URL].iov_len -
(4 + opts_end - opts));
int odhcpd_get_interface_config(const char *ifname, const char *what)
{
char buf[64];
-
+
snprintf(buf, sizeof(buf), "/proc/sys/net/ipv6/conf/%s/%s", ifname, what);
int fd = open(buf, O_RDONLY);
size_t dns_sz = 0, search_sz = 0, pref64_sz = 0, dnrs_sz = 0;
size_t pfxs_cnt = 0, routes_cnt = 0;
size_t total_addr_cnt = 0, valid_addr_cnt = 0;
- /*
+ /*
* lowest_found_lifetime stores the lowest lifetime of all prefixes;
* necessary to find longest adv interval necessary
* for shortest lived prefix
adv.h.nd_ra_flags_reserved |= ND_RA_PREF_LOW;
else if (iface->route_preference > 0)
adv.h.nd_ra_flags_reserved |= ND_RA_PREF_HIGH;
-
+
if (iface->dhcpv6 != MODE_DISABLED && iface->dhcpv6_pd && iface->dhcpv6_pd_preferred) {
/* RFC9762 § 5
* If the network desires to delegate prefixes to devices that support
- * DHCPv6 prefix delegation but do not support the P flag, it SHOULD
+ * DHCPv6 prefix delegation but do not support the P flag, it SHOULD
* also set the M or O bits in the RA to 1
*/
adv.h.nd_ra_flags_reserved |= ND_RA_FLAG_MANAGED;
}
if (preferred_lt > valid_lt) {
- /*
+ /*
* RFC4861 § 6.2.1
* This value [AdvPreferredLifetime] MUST NOT be larger than
* AdvValidLifetime.
p->nd_opt_pi_type = ND_OPT_PREFIX_INFORMATION;
p->nd_opt_pi_len = 4;
p->nd_opt_pi_prefix_len = (addr->prefix < 64) ? 64 : addr->prefix;
- /* RFC9762 DHCPv6-PD Preferred Flag § 6:
+ /* RFC9762 DHCPv6-PD Preferred Flag § 6:
* Routers SHOULD set the P flag to zero by default...
*/
p->nd_opt_pi_flags_reserved = 0;
/* RFC9762 DHCPv6-PD Preferred Flag
* We can run both SLAAC and DHCPv6-PD.
* §6:
- * "Routers MUST allow the P flag to be configured separately from the A flag.
+ * "Routers MUST allow the P flag to be configured separately from the A flag.
* ...en/disabling the P flag MUST NOT trigger automatic changes in the A flag
* value set by the router."
*/
// RFC6275, §7.2
p->nd_opt_pi_flags_reserved |= ND_OPT_PI_FLAG_RADDR;
if (i >= valid_addr_cnt || !preferred_lt) {
- /*
+ /*
* RFC9096 § 3.5
*
* - Any prefixes that were previously advertised by the CE router
define is used to cap values to a sane ceiling, i.e. ND_VALID_LIMIT.
*/
#define RouterLifetime 5400
-/* RFC4861 §6.2.1 : AdvReachableTime :
+/* RFC4861 §6.2.1 : AdvReachableTime :
* MUST be no greater than 3,600,000 msec
*/
#define AdvReachableTime 3600000
-/* RFC4861 §6.2.1 : AdvCurHopLimit
+/* RFC4861 §6.2.1 : AdvCurHopLimit
The value should be set to the current
diameter of the Internet. The value zero means
unspecified (by this router).
#define RETRANS_TIMER_MAX 60000
/* RFC2460 §5
IPv6 requires that every link in the internet have an MTU of 1280
- octets or greater.
+ octets or greater.
*/
#define RA_MTU_MIN 1280
#define RA_MTU_MAX 65535